package com.example.array.unit4.example2;

/**
 * @author ASUS
 */
public class RunoobTest {
  

    static void reverse(int[] a, int n) 
    { 
        int i, k, t; 
        for (i = 0; i < n / 2; i++) { 
            t = a[i]; 
            a[i] = a[n - i - 1]; 
            a[n - i - 1] = t; 
        } 
  
        System.out.println("反转后的数组是: \n"); 
        for (k = 0; k < n; k++) { 
            System.out.println(a[k]); 
        } 
    } 
  
    public static void main(String[] args) 
    { 
        int [] arr = {10, 20, 30, 40, 50}; 
        reverse(arr, arr.length); 
    } 
}